home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / CHASSIS_ / MOUSEDOW.C < prev    next >
Text File  |  1992-05-14  |  2KB  |  62 lines

  1. /************************************************************************************/
  2. /*    MouseDownProc                                                                    */
  3. /************************************************************************************/
  4.  
  5. #include "MyHeaders.h"
  6.  
  7. int MouseDownProc()
  8. {
  9.     int        MouseDRetCode = 0;
  10.     Boolean    passEvtFlag = TRUE;
  11.     
  12.     myMouseWhere = FindWindow(myEvent.where, &workWindowPtr);    /* Get loc. of click*/
  13.     switch (myMouseWhere)                            /* do things depending on loc.    */
  14.         {
  15.         case (inDesk):                                /* if just on desktop, do nada    */
  16.         break;
  17.         
  18.         case (inSysWindow):                            /* If in a system window        */
  19.             SystemClick (&myEvent, workWindowPtr);    /*   give it to Desk Manager    */
  20.         break;
  21.             
  22.         case (inMenuBar):                            /* If in the menu bar            */
  23.             worklong = MenuSelect(myEvent.where);    /*   get menu ID and item no.    */
  24.             if (worklong)                            /* if in a menu                    */
  25.                 WorkRetCode = MenuProc(worklong);    /*   perform menu command        */
  26.         break;
  27.         
  28.         default:                                    /* Must be in window structure    */
  29.             WorkRetCode = WhichWindow(workWindowPtr, &k);    /* match ptr to table    */
  30.             if (WorkRetCode == 0)                    /* if it's a good match            */
  31.                 {
  32.                 windSub = k;
  33.                 if (FrontWindow()!=windTbl[windSub].windPtr)        /* not active?    */
  34.                     {
  35.                     SelectWindow (windTbl[windSub].windPtr);        /*  activate it    */
  36.                     if (myMouseWhere != inDrag)        /* process mouseDown more only    */
  37.                         passEvtFlag = FALSE;        /* if it is in the drag region    */
  38.                     }
  39.                 if (passEvtFlag)
  40.                     {
  41.                     switch (windTbl[windSub].windRec.refCon)    /* window type            */
  42.                         {
  43.                         case (ProcMain):
  44.                             WorkRetCode = MainWindowProc();
  45.                         break;
  46.     
  47.                         case (ProcText):
  48.                             WorkRetCode = TextWindowProc();
  49.                         break;
  50.     
  51.                         case (ProcHelp):
  52.                             WorkRetCode = HelpWindowProc();
  53.                         break;
  54.                         }
  55.                     }
  56.                 }
  57.         break;
  58.         }
  59.  
  60.     return MouseDRetCode;
  61. }
  62.